package com.kyl.controller;


import com.kyl.base.ResponseResult;
import com.kyl.file.FileStorageService;
import com.kyl.utils.UUID;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.annotation.Resources;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;

/**
 * @author WanJl
 * @version 1.0
 * @title CommonController
 * @description
 * @create 2025/1/19
 */
@RestController
@RequestMapping("/common")
@Api(tags = "通用接口")
@Slf4j
public class CommonController {

    @Resource
    private FileStorageService fileStorageService;


    @PostMapping("/upload")
    @ApiOperation("文件上传接口")
    public ResponseResult<String> upload(
            @ApiParam(value = "上传的文件")
            @RequestPart("file") MultipartFile file) {

        String filePath = fileStorageService.quickUploadImageFile(file);

        return ResponseResult.success("",filePath);
    }


}
